////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Applicable File Name: image_common.h
// Editor: Achates
//
// Copyright (c) Taotaosou Inc(2010-2011)
// 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef _IMAGE_COMMON_H_
#define _IMAGE_COMMON_H_

#include "cv.h"
#include "TErrorCode.h"

#define MIN_IMAGE_SIZE       16     //the min value of image size
#define NORMAL_IMAGE_SIZE    256    //Normalized image size

__inline int IsValidImage(IplImage *pImage)
{
	if (!pImage)
		return TEC_INVALID_PARAM;

	//only support 3 channels and 8U depth now
	if (pImage->nChannels != 3 || pImage->depth != IPL_DEPTH_8U)
		return TEC_UNSUPPORTED;

	//ensure image size
	if (pImage->width < MIN_IMAGE_SIZE || pImage->height < MIN_IMAGE_SIZE)
	{
		// Do not process too small image
		return TEC_UNSUPPORTED;	
	}
	return TOK;
}

#endif 
